     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


{# context lib = "gstreamer" prefix = "gst" #}

eventType :: Event
          -> EventType
eventType event =
    cToEnum $ unsafePerformIO $ withMiniObject event cEventType
foreign import ccall unsafe "_hs_gst_event_type"
    cEventType :: Ptr Event
               -> IO {# type GstEventType #}

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

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

eventTypeGetName :: EventType
                 -> String
