     withTagList tagList ({# call event_new_tag #} . castPtr) >>=
         takeMiniObject
 
-eventParseBufferSize :: Event
+eventParseBufferSize :: EventClass event
+                     => event
                      -> Maybe (Format, Int64, Int64, Bool)
 eventParseBufferSize event | eventType event == EventBufferSize =
     Just $ unsafePerformIO $ alloca $ \formatPtr -> alloca $ \minSizePtr ->
         alloca $ \maxSizePtr -> alloca $ \asyncPtr ->
-            do {# call event_parse_buffer_size #} event
+            do {# call event_parse_buffer_size #} (toEvent event)
                                                   formatPtr
                                                   minSizePtr
                                                   maxSizePtr

                       return (rate, format, flags, startType, start, stopType, stop)
                     | otherwise = Nothing

eventParseTag :: Event
              -> Maybe TagList
eventParseTag event | eventType event == EventTag =
    Just $ unsafePerformIO $ alloca $ \tagListPtr ->
        do {# call event_parse_tag #} event (castPtr tagListPtr)
           peek tagListPtr >>= peekTagList

eventTypeGetName :: EventType
                 -> String

--  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#}
