    -- GENERATED by C->Haskell Compiler, version 0.13.5 (gtk2hs branch) "Bin IO", 13 Nov 2004 (Haskell)
    -- Edit the ORIGNAL .chs file instead!

    {-# LINE 1 "./Media/Streaming/GStreamer/Core/Pipeline.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://www.gnu.org/licenses/>.
    --
    --  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.Core.Pipeline (
      Pipeline,
      PipelineClass,
      castToPipeline,
      gTypePipeline,

      pipelineNew,
      pipelineGetBus,
      pipelineSetClock,
      pipelineUseClock,
      pipelineSetNewStreamTime,
      pipelineGetLastStreamTime,
      pipelineSetAutoFlushBus,
      pipelineGetAutoFlushBus,
      pipelineSetDelay,
      pipelineGetDelay,

      pipelineAutoFlushBus,
      pipelineDelay
      ) where

    import Control.Monad (liftM)
    import Media.Streaming.GStreamer.Core.Types
    {-# LINE 51 "./Media/Streaming/GStreamer/Core/Pipeline.chs" #-}
    import System.Glib.UTFString
    import System.Glib.FFI
    import System.Glib.Attributes ( Attr
                                  , newAttr )

    {-# LINE 57 "./Media/Streaming/GStreamer/Core/Pipeline.chs" #-}

    pipelineNew :: String
                -> IO Element
    pipelineNew name =
        withUTFString name gst_pipeline_new >>=
            takeObject

    pipelineGetBus :: PipelineClass pipeline
                   => pipeline
                   -> IO Bus
    pipelineGetBus pipeline =
        (\(Pipeline arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_pipeline_get_bus argPtr1) (toPipeline pipeline) >>= takeObject

    pipelineSetClock :: (PipelineClass pipeline, ClockClass clock)
                     => pipeline
                     -> clock
                     -> IO Bool
    pipelineSetClock pipeline clock =
        liftM toBool $
            (\(Pipeline arg1) (Clock arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gst_pipeline_set_clock argPtr1 argPtr2) (toPipeline pipeline) (toClock clock)

    pipelineUseClock :: (PipelineClass pipeline, ClockClass clock)
                     => pipeline
                     -> clock
                     -> IO ()
    pipelineUseClock pipeline clock =
        (\(Pipeline arg1) (Clock arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gst_pipeline_use_clock argPtr1 argPtr2) (toPipeline pipeline) (toClock clock)

    pipelineSetNewStreamTime :: PipelineClass pipeline
                             => pipeline
                             -> ClockTime
                             -> IO ()
    pipelineSetNewStreamTime pipeline time =
        (\(Pipeline arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gst_pipeline_set_new_stream_time argPtr1 arg2) (toPipeline pipeline)
                                                (fromIntegral time)

    pipelineGetLastStreamTime :: PipelineClass pipeline
                              => pipeline
                              -> IO ClockTime
    pipelineGetLastStreamTime pipeline =
        liftM fromIntegral $
            (\(Pipeline arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_pipeline_get_last_stream_time argPtr1) (toPipeline pipeline)

    pipelineSetAutoFlushBus :: PipelineClass pipeline
                            => pipeline
                            -> Bool
                            -> IO ()
    pipelineSetAutoFlushBus pipeline autoFlush =
        (\(Pipeline arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gst_pipeline_set_auto_flush_bus argPtr1 arg2) (toPipeline pipeline) $ fromBool autoFlush

    pipelineGetAutoFlushBus :: PipelineClass pipeline
                            => pipeline
                            -> IO Bool
    pipelineGetAutoFlushBus pipeline =
        liftM toBool $
            (\(Pipeline arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_pipeline_get_auto_flush_bus argPtr1) (toPipeline pipeline)

    pipelineSetDelay :: PipelineClass pipeline
                     => pipeline
                     -> ClockTime
                     -> IO ()
    pipelineSetDelay pipeline delay =
        (\(Pipeline arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gst_pipeline_set_delay argPtr1 arg2) (toPipeline pipeline)
                                      (fromIntegral delay)

    pipelineGetDelay :: PipelineClass pipeline
                     => pipeline
                     -> IO ClockTime
    pipelineGetDelay pipeline =
        liftM fromIntegral $
            (\(Pipeline arg1) -> withForeignPtr arg1 $ \argPtr1 ->gst_pipeline_get_delay argPtr1) (toPipeline pipeline)

    pipelineAutoFlushBus :: PipelineClass pipelineT
                         => Attr pipelineT Bool
    pipelineAutoFlushBus = newAttr
        pipelineGetAutoFlushBus
        pipelineSetAutoFlushBus

    pipelineDelay :: PipelineClass pipelineT
                  => Attr pipelineT ClockTime
    pipelineDelay = newAttr
        pipelineGetDelay
        pipelineSetDelay

    foreign import ccall safe "gst_pipeline_new"
      gst_pipeline_new :: ((Ptr CChar) -> (IO (Ptr Element)))

    foreign import ccall safe "gst_pipeline_get_bus"
      gst_pipeline_get_bus :: ((Ptr Pipeline) -> (IO (Ptr Bus)))

    foreign import ccall safe "gst_pipeline_set_clock"
      gst_pipeline_set_clock :: ((Ptr Pipeline) -> ((Ptr Clock) -> (IO CInt)))

    foreign import ccall safe "gst_pipeline_use_clock"
      gst_pipeline_use_clock :: ((Ptr Pipeline) -> ((Ptr Clock) -> (IO ())))

    foreign import ccall safe "gst_pipeline_set_new_stream_time"
      gst_pipeline_set_new_stream_time :: ((Ptr Pipeline) -> (CULLong -> (IO ())))

    foreign import ccall safe "gst_pipeline_get_last_stream_time"
      gst_pipeline_get_last_stream_time :: ((Ptr Pipeline) -> (IO CULLong))

    foreign import ccall safe "gst_pipeline_set_auto_flush_bus"
      gst_pipeline_set_auto_flush_bus :: ((Ptr Pipeline) -> (CInt -> (IO ())))

    foreign import ccall safe "gst_pipeline_get_auto_flush_bus"
      gst_pipeline_get_auto_flush_bus :: ((Ptr Pipeline) -> (IO CInt))

    foreign import ccall safe "gst_pipeline_set_delay"
      gst_pipeline_set_delay :: ((Ptr Pipeline) -> (CULLong -> (IO ())))

    foreign import ccall safe "gst_pipeline_get_delay"
      gst_pipeline_get_delay :: ((Ptr Pipeline) -> (IO CULLong))