                        return (update, rate, format, start, stop, position)
                            | otherwise = Nothing
 
-eventParseNewSegmentFull :: Event
+eventParseNewSegmentFull :: EventClass event
+                         => event
                          -> Maybe (Bool, Double, Double, Format, Int64, Int64, Int64)
 eventParseNewSegmentFull event | eventType event == EventNewSegment =
     Just $ unsafePerformIO $ alloca $ \updatePtr ->
         alloca $ \ratePtr -> alloca $ \appliedRatePtr ->
             alloca $ \formatPtr -> alloca $ \startPtr ->
                 alloca $ \stopPtr -> alloca $ \positionPtr ->
-                    do {# call event_parse_new_segment_full #} event
+                    do {# call event_parse_new_segment_full #} (toEvent event)
                                                                ratePtr
                                                                appliedRatePtr
                                                                updatePtr

                       return (update, rate, appliedRate, format, start, stop, position)
                           | otherwise = Nothing

eventParseQOS :: Event
              -> Maybe (Double, ClockTimeDiff, ClockTime)
eventParseQOS event | eventType event == EventQOS =
    Just $ unsafePerformIO $ alloca $ \proportionPtr ->
        alloca $ \diffPtr -> alloca $ \timestampPtr ->
            do {# call event_parse_qos #} event
                                          proportionPtr
                                          diffPtr
                                          timestampPtr

--  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)
--  
--  An object describing events that are passed up and down a pipeline.
module Media.Streaming.GStreamer.Core.Event (

-- * Detail

  -- | An 'Event' is a message that is passed up and down a pipeline.
  --   
  --   There are a number of predefined events and functions returning
  --   events. To send an event an application will usually use
  --   'Media.Streaming.GStreamer.Core.Element.elementSendEvent', and
  --   elements will use
  --   'Media.Streaming.GStreamer.Core.Pad.padSendEvent' or
  --   'Media.Streaming.GStreamer.Core.padPushEvent'.
  --   
  --   

-- * Types
  Event,
  EventClass,
  EventType(..),

-- * Event Operations
  eventType,
  eventNewCustom,
  eventNewEOS,
  eventNewFlushStart,
  eventNewFlushStop,
  eventNewLatency,
  eventNewNavigation,
  eventNewNewSegment,
  eventNewNewSegmentFull,
  eventNewQOS,
  eventNewSeek,
  eventNewTag,
  eventParseBufferSize,
  eventParseLatency,
  eventParseNewSegment,
  eventParseNewSegmentFull,
  eventParseQOS,
  eventParseSeek,
  eventParseTag,
  eventTypeGetName,
  eventTypeGetFlags,
  ) where


import Control.Monad (liftM)
{#import Media.Streaming.GStreamer.Core.Types#}
