                return (format, minSize, maxSize, async)
                            | otherwise = Nothing
 
-eventParseLatency :: Event
+eventParseLatency :: EventClass event
+                  => event
                   -> Maybe ClockTime
 eventParseLatency event | eventType event == EventLatency =
     Just $ unsafePerformIO $ alloca $ \latencyPtr ->
-        do {# call event_parse_latency #} event
+        do {# call event_parse_latency #} (toEvent event)
                                           latencyPtr
            liftM fromIntegral $ peek latencyPtr
                         | otherwise = Nothing
 
-eventParseNewSegment :: Event
+eventParseNewSegment :: EventClass event
+                     => event
                      -> Maybe (Bool, Double, Format, Int64, Int64, Int64)
 eventParseNewSegment event | eventType event == EventNewSegment =
     Just $ unsafePerformIO $ alloca $ \updatePtr ->
         alloca $ \ratePtr -> alloca $ \formatPtr ->
             alloca $ \startPtr -> alloca $ \stopPtr ->
                 alloca $ \positionPtr ->
-                    do {# call event_parse_new_segment #} event
+                    do {# call event_parse_new_segment #} (toEvent event)
                                                           ratePtr
                                                           updatePtr
                                                           formatPtr

    withTagList tagList ({# call event_new_tag #} . castPtr) >>=
        takeMiniObject

eventParseBufferSize :: 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
                                                  formatPtr
                                                  minSizePtr
                                                  maxSizePtr

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

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 #} (toEvent event)
                                                               ratePtr
                                                               appliedRatePtr
                                                               updatePtr
