    {-# LINE 2 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}
    -- GIMP Toolkit (GTK) Binding for Haskell: binding to gstreamer -*-haskell-*-
    --
    -- Author : Peter Gavin
    -- Created: 1-Apr-2007
    --
    -- Copyright (c) 2007 Peter Gavin
    --
    -- 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 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
    -- Lesser General Public License for more details.
    --
    -- You should have received a copy of the GNU Lesser General Public
    -- License along with this program. If not, see
    -- <http:
    --
    -- GStreamer, the C library which this Haskell library depends on, is
    -- available under LGPL Version 2. The documentation included with
    -- this library is based on the original GStreamer documentation.
    --
    -- | Maintainer : gtk2hs-devel@lists.sourceforge.net
    -- Stability : alpha
    -- Portability : portable (depends on GHC)
    module Media.Streaming.GStreamer.Base.Adapter (

      Adapter,
      AdapterClass,
      castToAdapter,
      gTypeAdapter,

      adapterNew,
      adapterClear,
      adapterPush,

      adapterFlush,
      adapterAvailable,
      adapterAvailableFast,

      adapterTakeBuffer

      ) where

    import Control.Monad (liftM)
    {-# LINE 73 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}
    import Media.Streaming.GStreamer.Base.Types
    {-# LINE 74 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}
    import System.Glib.FFI
    import System.Glib.GObject
    import System.Glib.Flags
    import System.Glib.Attributes
    import System.Glib.Properties
    {-# LINE 79 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}

    {-# LINE 81 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}

    adapterNew :: IO Adapter
    adapterNew =
        wrapNewGObject mkAdapter gst_adapter_new
    {-# LINE 85 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}

    adapterClear :: AdapterClass adapterT
                 => adapterT
                 -> IO ()
    adapterClear =
        (\(Adapter arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_adapter_clear argPtr1) . toAdapter

    adapterPush :: (AdapterClass adapterT, BufferClass bufferT)
                => adapterT
                -> bufferT
                -> IO ()
    adapterPush adapter buffer =
        (\(Adapter arg1) (Buffer arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gst_adapter_push argPtr1 argPtr2) (toAdapter adapter) (toBuffer buffer)
    {-# LINE 143 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}
    adapterFlush :: AdapterClass adapterT
                 => adapterT
                 -> Word
                 -> IO ()
    adapterFlush adapter flush =
        (\(Adapter arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gst_adapter_flush argPtr1 arg2) (toAdapter adapter) $ fromIntegral flush

    adapterAvailable :: AdapterClass adapterT
                     => adapterT
                     -> IO Word
    adapterAvailable adapter =
        liftM fromIntegral $
            (\(Adapter arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_adapter_available argPtr1) $ toAdapter adapter

    adapterAvailableFast :: AdapterClass adapterT
                         => adapterT
                         -> IO Word
    adapterAvailableFast adapter =
        liftM fromIntegral $
            (\(Adapter arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_adapter_available_fast argPtr1) $ toAdapter adapter
    {-# LINE 185 "./Media/Streaming/GStreamer/Base/Adapter.chs" #-}
    adapterTakeBuffer :: AdapterClass adapterT
                      => adapterT
                      -> Word
                      -> IO (Maybe Buffer)
    adapterTakeBuffer adapter nBytes =
        (\(Adapter arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gst_adapter_take_buffer argPtr1 arg2) (toAdapter adapter) (fromIntegral nBytes) >>=
            maybePeek takeMiniObject

    foreign import ccall safe "gst_adapter_new"
      gst_adapter_new :: (IO (Ptr Adapter))

    foreign import ccall safe "gst_adapter_clear"
      gst_adapter_clear :: ((Ptr Adapter) -> (IO ()))

    foreign import ccall safe "gst_adapter_push"
      gst_adapter_push :: ((Ptr Adapter) -> ((Ptr Buffer) -> (IO ())))

    foreign import ccall safe "gst_adapter_flush"
      gst_adapter_flush :: ((Ptr Adapter) -> (CUInt -> (IO ())))

    foreign import ccall safe "gst_adapter_available"
      gst_adapter_available :: ((Ptr Adapter) -> (IO CUInt))

    foreign import ccall safe "gst_adapter_available_fast"
      gst_adapter_available_fast :: ((Ptr Adapter) -> (IO CUInt))

    foreign import ccall safe "gst_adapter_take_buffer"
      gst_adapter_take_buffer :: ((Ptr Adapter) -> (CUInt -> (IO (Ptr Buffer))))