Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The following functions allow you to detect the media type of an unknown stream.
- newtype TypeFind = TypeFind (ManagedPtr TypeFind)
- newZeroTypeFind :: MonadIO m => m TypeFind
- noTypeFind :: Maybe TypeFind
- data TypeFindGetLengthMethodInfo
- typeFindGetLength :: (HasCallStack, MonadIO m) => TypeFind -> m Word64
- data TypeFindPeekMethodInfo
- typeFindPeek :: (HasCallStack, MonadIO m) => TypeFind -> Int64 -> m (Maybe ByteString)
- typeFindRegister :: (HasCallStack, MonadIO m, IsPlugin a) => Maybe a -> Text -> Word32 -> TypeFindFunction -> Maybe Text -> Caps -> m Bool
- data TypeFindSuggestMethodInfo
- typeFindSuggest :: (HasCallStack, MonadIO m) => TypeFind -> Word32 -> Caps -> m ()
- clearTypeFindData :: MonadIO m => TypeFind -> m ()
- getTypeFindData :: MonadIO m => TypeFind -> m (Ptr ())
- setTypeFindData :: MonadIO m => TypeFind -> Ptr () -> m ()
- typeFind_data :: AttrLabelProxy "data"
- clearTypeFindGetLength :: MonadIO m => TypeFind -> m ()
- getTypeFindGetLength :: MonadIO m => TypeFind -> m (Maybe TypeFindGetLengthFieldCallback)
- setTypeFindGetLength :: MonadIO m => TypeFind -> FunPtr C_TypeFindGetLengthFieldCallback -> m ()
- typeFind_getLength :: AttrLabelProxy "getLength"
- clearTypeFindPeek :: MonadIO m => TypeFind -> m ()
- getTypeFindPeek :: MonadIO m => TypeFind -> m (Maybe TypeFindPeekFieldCallback)
- setTypeFindPeek :: MonadIO m => TypeFind -> FunPtr C_TypeFindPeekFieldCallback -> m ()
- typeFind_peek :: AttrLabelProxy "peek"
- clearTypeFindSuggest :: MonadIO m => TypeFind -> m ()
- getTypeFindSuggest :: MonadIO m => TypeFind -> m (Maybe TypeFindSuggestFieldCallback)
- setTypeFindSuggest :: MonadIO m => TypeFind -> FunPtr C_TypeFindSuggestFieldCallback -> m ()
- typeFind_suggest :: AttrLabelProxy "suggest"
Exported types
WrappedPtr TypeFind Source # | |
(~) AttrOpTag tag AttrSet => Constructible TypeFind tag Source # | |
((~) * info (ResolveTypeFindMethod t TypeFind), MethodInfo * info TypeFind p) => IsLabel t (TypeFind -> p) Source # | |
((~) * info (ResolveTypeFindMethod t TypeFind), MethodInfo * info TypeFind p) => IsLabelProxy t (TypeFind -> p) Source # | |
HasAttributeList * TypeFind Source # | |
((~) * signature (Word32 -> Caps -> m ()), MonadIO m) => MethodInfo * TypeFindSuggestMethodInfo TypeFind signature Source # | |
((~) * signature (Int64 -> m (Maybe ByteString)), MonadIO m) => MethodInfo * TypeFindPeekMethodInfo TypeFind signature Source # | |
((~) * signature (m Word64), MonadIO m) => MethodInfo * TypeFindGetLengthMethodInfo TypeFind signature Source # | |
type AttributeList TypeFind Source # | |
Methods
getLength
data TypeFindGetLengthMethodInfo Source #
((~) * signature (m Word64), MonadIO m) => MethodInfo * TypeFindGetLengthMethodInfo TypeFind signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> TypeFind |
|
-> m Word64 | Returns: The length of the data stream, or 0 if it is not available. |
Get the length of the data stream.
peek
data TypeFindPeekMethodInfo Source #
((~) * signature (Int64 -> m (Maybe ByteString)), MonadIO m) => MethodInfo * TypeFindPeekMethodInfo TypeFind signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> TypeFind |
|
-> Int64 |
|
-> m (Maybe ByteString) | Returns: the
requested data, or |
Returns the size
bytes of the stream to identify beginning at offset. If
offset is a positive number, the offset is relative to the beginning of the
stream, if offset is a negative number the offset is relative to the end of
the stream. The returned memory is valid until the typefinding function
returns and must not be freed.
register
:: (HasCallStack, MonadIO m, IsPlugin a) | |
=> Maybe a | |
-> Text |
|
-> Word32 |
|
-> TypeFindFunction |
|
-> Maybe Text |
|
-> Caps |
|
-> m Bool |
Registers a new typefind function to be used for typefinding. After registering this function will be available for typefinding. This function is typically called during an element's plugin initialization.
suggest
data TypeFindSuggestMethodInfo Source #
((~) * signature (Word32 -> Caps -> m ()), MonadIO m) => MethodInfo * TypeFindSuggestMethodInfo TypeFind signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> TypeFind |
|
-> Word32 |
|
-> Caps |
|
-> m () |
If a TypeFindFunction
calls this function it suggests the caps with the
given probability. A TypeFindFunction
may supply different suggestions
in one call.
It is up to the caller of the TypeFindFunction
to interpret these values.
Properties
data
clearTypeFindData :: MonadIO m => TypeFind -> m () Source #
typeFind_data :: AttrLabelProxy "data" Source #
getLength
clearTypeFindGetLength :: MonadIO m => TypeFind -> m () Source #
getTypeFindGetLength :: MonadIO m => TypeFind -> m (Maybe TypeFindGetLengthFieldCallback) Source #
setTypeFindGetLength :: MonadIO m => TypeFind -> FunPtr C_TypeFindGetLengthFieldCallback -> m () Source #
typeFind_getLength :: AttrLabelProxy "getLength" Source #
peek
clearTypeFindPeek :: MonadIO m => TypeFind -> m () Source #
getTypeFindPeek :: MonadIO m => TypeFind -> m (Maybe TypeFindPeekFieldCallback) Source #
setTypeFindPeek :: MonadIO m => TypeFind -> FunPtr C_TypeFindPeekFieldCallback -> m () Source #
typeFind_peek :: AttrLabelProxy "peek" Source #
suggest
clearTypeFindSuggest :: MonadIO m => TypeFind -> m () Source #
getTypeFindSuggest :: MonadIO m => TypeFind -> m (Maybe TypeFindSuggestFieldCallback) Source #
setTypeFindSuggest :: MonadIO m => TypeFind -> FunPtr C_TypeFindSuggestFieldCallback -> m () Source #
typeFind_suggest :: AttrLabelProxy "suggest" Source #